package com.array;

import java.util.Arrays;

public class Demo04 {
    public static void main(String[] args) {
        int[] a = {1,4,76,89,45,23};
        System.out.println(a); //[I@4554617c
        System.out.println(Arrays.toString(a));
        printArray(a);
    }

    public static void printArray(int[] a){
        for (int i = 0; i < a.length; i++) {
            if(i==0){
                System.out.print("[");
            }
            if(i==a.length-1){
                System.out.print(a[i]+"]");
            }else {
                System.out.print(a[i]+", ");
            }
        }
    }
}
